<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%     
	String path = request.getContextPath();     
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";     
%>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>查看项目</title>
    <base href="<%=basePath%>"/>
    <%@ include file="../../cuv_include.jsp"%>
    <%@ include file="../../list_include.jsp"%>
    <link rel="stylesheet" type="text/css" href="css/common.css" />
    <style type="text/css">
    	fieldset,legend,form,table,tr,td,textarea{margin:0;padding:0}
    	table{margin:10px 10px};
  		td{line-height: 40px;}
  		label {font-weight:bold;}
		input[type="text"]{width:250px;}
		input[type="password"]{width:250px;}
		input[type="textarea"]{width:250px;}  		
    </style>
    <script type="text/javascript">
	    $(document).ready(function(){
	    	$("#attview").tablesorter({theme:'green', widgets:['zebra', "resizable"]});
	        var options = {dataType: 'json', success: process};
	        $("#userForm").submit(function(){
	        	$("#btn_update").attr("disabled","disabled");
	            $(this).ajaxSubmit(options);
	            return false;
	        });
	  	});
	    function process(responseJson) {
	    	$("#btn_update").removeAttr("disabled");
	    	if(responseJson.code == 0) return;
	        var str = "<div style='word-wrap:break-word; word-break:normal; margin: 10px 0 0 0; line-height: 1.6;'>"+
     		responseJson.createtime+"&nbsp;&nbsp;<font color='red'>"+responseJson.username+"</font>："+
     		"<span style='color:#00A;'>"+responseJson.content+"</span></div>";
	        $("#commentSet").prepend(str);
	  		$("#content").val("");
	    }
	  function back(){
		  var qs = $("#qs").val();
	        location.href = "<%=basePath%>pjcost/project/list.do?" + qs;
	  }
	  </script>
  </head>
  
  <body>
  	<div style="width: 1408px;">
  	<input id="qs" name="qs" type="hidden" value="${qs}"/>
    <div style="float:left; width: 55%;">
		<div style="width: 100%;">
	        <table>
	          <tr>
	            <td><label for="name">项目名：</label></td>
	            <td>
	            	<input type="text" name="name" disabled="disabled" id="name" value="${project.name }" />
	            </td>
	            </tr>
	          <tr>
	            <td><label for="province">省份：</label></td>
	            <c:forEach var="province" items="${provincesList}" varStatus="status">
			  	  	<c:if test="${province.value == project.province}">
			  	  		<td><input type="text" name="province" disabled="disabled" id="province" value="${province.name }" /></td>
			  	  	</c:if>
		  	  	</c:forEach>
	          </tr>
	          <tr>
	            <td><label for="lastModifyTime">最后修改时间：</label></td>
	            <td>
	            	<input type="text" name="lastModifyTime" disabled="disabled" id="lastModifyTime" value="${project.lastModifyTime }" />
	            </td>
	            </tr>
	          <tr>
	            <td><label for="code">项目编码：</label></td>
	            <td>
	            	<input type="text" name="code" disabled="disabled" id="code" value="${project.code }" />
	            </td>
	          </tr> 
	          <tr>
	            <td><label for="applyTime">申报时间：</label></td>
	            <td>
	            	<input type="text" name="applyTime" disabled="disabled" id="applyTime" value="${project.applyTime }" />
	            </td>
	            </tr>
	          <tr>
	            <td><label for="expectedTime">预计上线时间：</label></td>
	            <td>
	            	<input type="text" name="expectedTime" disabled="disabled" id="expectedTime" value="${project.expectedTime }" />
	            </td>
	          </tr> 
	          <tr>
	            <td><label for="projectedScale">预计规模：</label></td>
	            <td>
	            	<input type="text" name="expectedScale" disabled="disabled" id="expectedScale" value="${project.expectedScale }" />
	            </td>
	            </tr>
	          <tr>
	            <td><label for="applyUser">申请人：</label></td>
	            <td>
	            	<input type="text" name="applyUser" disabled="disabled" id="applyUser" value="${user.cnname }" />
	            </td>
	          </tr>
	          <tr>
	            <td><label for="operator">经办人：</label></td>
	            <td>
	            	<input type="text" name="operator" disabled="disabled" id="operator" value="${project.operator }" />
	            </td>
	            </tr>
	          <tr>
	            <td><label for="customerCompany">用户单位名称：</label></td>
	            <td>
	            	<input type="text" name="customerCompany" disabled="disabled" id="customerCompany" value="${project.customerCompany }" />
	            </td>
	          </tr>
	          <tr>
	            <td><label for="connector">客户经理：</label></td>
	            <td>
	            	<input type="text" name="connector" disabled="disabled" id="connector" value="${project.connector }" />
	            </td>
	          </tr>
	          <tr>
	            <td><label for="customerContactor">联系人名称：</label></td>
	            <td>
	            	<input type="text" name="customerContactor" disabled="disabled" id="customerContactor" value="${project.customerContactor }" />
	            </td>
	            </tr>
	          <tr>
	            <td><label for="customerPhone">联系人电话：</label></td>
	            <td>
	            	<input type="text" name="customerPhone" disabled="disabled" id="customerPhone" value="${project.customerPhone }" />
	            </td>
	          </tr>
	          <tr>
	            <td valign="top"><label for="description">项目描述：</label></td>
	            <td valign="top">
	            	<textarea name="description" id="description" cols="60" readonly="readonly" rows="10"><c:out value="${project.description }"/></textarea>
	            </td>
	          </tr>           
	        </table>  
	        <table id="attview" class="tablesorter" style="width: 90%; float: right;">
	          <thead>
	              <tr><td colspan="4"><font size="3" ><b>附件：</b></font></td></tr>
		          <tr><th>文件名</th><th>上传时间</th><th>上传者</th></tr>
	          </thead>
	          <tbody>
	              <c:forEach var="model" items="${attachList}">
	              <tr><td><a href="<%=basePath%>pjcost/project/download.do?id=${model.id}">${model.name}</a> </td><td>${model.createTime}</td><td>${user.cnname}</td></tr>
	              </c:forEach>
	              <c:if test="${fn:length(attachList)<=0}">
	                <tr>
	                  <td colspan="3">暂时还未上传任何附件!</td>
	                </tr>
	              </c:if>
	               </tbody>
	            </table>
			</div>
			<div style="float: left; width: 100%; padding-left: 8%;">
				<input type="button" id="btn_back" onclick="back();" value="返回" style="width:80px;" />
			</div>	
	  </div> 
	<div style="float:left; width: 450px; margin:0 0 0 5px ">  
    	<div id="commentSet">
    	<c:forEach var="comment" items="${comments}" varStatus="status">
         	<div style="word-wrap:break-word; word-break:normal; margin: 10px 0 0 0; line-height: 1.6;">
         		<fmt:formatDate value="${comment.createTime}" type="both" dateStyle="medium" timeStyle="medium" />
         		&nbsp;&nbsp;<font color="red">${comment.userCnname}</font>：
         		<span style="color:#00A;">${comment.content}</span>
         	</div>
    	</c:forEach>
    	</div>
	    	
	    <div>
	    	<form id="userForm" method="post" action="pjcost/project/view.do">
	    		<input type="hidden" name="objectId" value="${project.id}" />
	    		<input type="hidden" name="userEnname" value="userenname" />
	    		<input type="hidden" name="objectType" value="2" />
		    	<table style="margin:20px 0 0 0;">
		    		<tr>
		            	<td valign="top"><label for="content">新回复：</label></td>
		            	<td valign="top"><textarea name="content" id="content" cols="40" rows="3"><c:out value=""/></textarea></td>
		            </tr>
		            <tr>
		            	<td></td>
		            	<td>
		            		<input type="submit" id="btn_update" value="提交" style="width:80px;" />
		            		<input type="button" id="btn_back" onclick="back();" value="返回" style="width:80px;" />
		            	</td>
		          </tr>
		    	</table>
	    	</form>
	    </div> 
	  </div>
	  </div>
  </body>
</html>